<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>购物车布局</title>
  <link href="css/cart.css" rel="stylesheet">
  <!-- 引入模态框样式（假设使用的是简单的CSS模态框实现，你可以根据实际情况调整） -->
  <link href="css/modal.css" rel="stylesheet">
</head>

<body>
  <div id="app" class="container">
    <!-- 空购物车界面 -->
    <div class="empty-cart-message" v-if="cartList.length === 0">
      <div class="empty-cart-image"></div>
      您的购物车空空如也
      <a href="#" class="go-checkout">去购物</a>
    </div>
    <div class="cart" v-else>
      <h1>科泰淘购物车</h1>
      <div class="clearfix">
        <a href="#" class="delete-selected" @click="deleteSelectedGoods">删除选中</a>
        <a href="#" class="clear-cart" @click="clearAllGoodsInCart">清空购物车</a>
      </div>
      <div class="cart-item" v-for="(item, index) in cartList" :key="item.id">
        <div class="cart-item-details">
          <input type="checkbox" class="cart-item-checkbox" v-model="item.checked" @change="updateTotalPrice">
          <img :src="item.imgUrl" alt="{{ item.goodsName }}">
          <div class="cart-item-name-sku">
            <div class="cart-item-name">{{ item.goodsName }}</div>
            <div class="cart-item-sku">颜色：{{ item.color }} 尺码：{{ item.size }}</div>
          </div>
        </div>
        <div class="cart-item-quantity-price">
          <div class="cart-item-quantity">
            <button class="quantity-btn minus-btn" @click.prevent="decreaseQuantity(index)">-</button>
            <input type="text" name="quantity" class="quantity" v-model.number="item.count" @input="updateTotalPrice">
            <button class="quantity-btn plus-btn" @click.prevent="increaseQuantity(index)">+</button>
          </div>
          <div class="cart-item-price">￥{{ item.price }}</div>
        </div>
      </div>
      <div class="total-price-container">
        <div class="total-count">已选 <span class="count-value">{{ totalSelectedCount }}</span> 件</div>
        <div class="total-price">总计：￥{{ totalSelectedPrice }}</div>
      </div>
      <div class="clearfix">
        <div class="select-all-container">
          <input type="checkbox" id="select-all-checkbox" class="cart-item-checkbox" v-model="isAllSelected" @change="selectAll">
          <label for="select-all-checkbox">全选</label>
        </div>
        <a href="#" class="go-checkout" @click="goToCheckout">去结算</a>
      </div>
    </div>
    <!-- 模态框 -->
    <div class="modal" v-if="isModalVisible">
      <div class="modal-content">
        <span class="close-modal" @click="closeModal">&times;</span>
        <p>您的购物车空空如也</p>
      </div>
    </div>
  </div>
  <script src="js/vue.js"></script>
  <script src="js/cart-vue.js"></script>
</body>

</html>